/**
 * @file MainForm
 *
 * @brief 
 *
 * @author gyzheng
 *
 * @mail gyazheng@gmail.com
 *
 * @date 07/27/2011 22:37:51 
 *
 */

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

using CarFrameWork.Model;
using CarFrameWork.UI.Common;


namespace CarFrameWork.UI.InfoManage.Mangage
{
    public partial class NewFormBase : DetailForm
    {
        protected NewList m_NewList;
        public NewFormBase()
        {
            InitializeComponent();
        }

        private bool InspectionText(TextBox text)
        {
            if (string.Empty == text.Text.Trim())
                return false;
            return true;
        }

        protected bool TestContent()
        {
            if (!InspectionText(this.txtNewName))
                return false;
            if (!InspectionText(this.txtDescript))
                return false;
            return true;
        }

        protected void SetModelToForm()
        {
            txtNewID.Text = m_NewList.ID.ToString();
            txtNewName.Text = m_NewList.NewTitle.ToString();
            txtDescript.Text = m_NewList.Caption.ToString();
            dtNewTime.Value = m_NewList.NewTime;
        }

        protected void GetFormToModel()
        {
            //m_NewList.ID = Convert.ToInt32(txtNewID.Text.Trim());
            m_NewList.NewTitle = txtNewName.Text.ToString();
            m_NewList.Caption = txtDescript.Text.ToString();
            m_NewList.NewTime = dtNewTime.Value;
        }

        private void quitBtn_Click(object sender, EventArgs e)
        {
            this.Close();
        }
    }
}